import request from '@/utils/request'
export function fetchList(params) {
  return request({
    url: '/crm/goods/list',
    method: 'get',
    params: params
  })
}
export function updatePublishStatus(params) {
  return request({
    url: '/crm/goods/list',
    method: 'get',
    params: params
  })
}
export function fetchSimpleList(params) {
  return request({
    url: '/product/simpleList',
    method: 'get',
    params: params
  })
}

export function updateDeleteStatus(params) {
  return request({
    url: '/product/update/deleteStatus',
    method: 'post',
    params: params
  })
}


export function updateNewStatus(params) {
  return request({
    url: '/product/update/newStatus',
    method: 'post',
    params: params
  })
}

export function updateRecommendStatus(params) {
  return request({
    url: '/product/update/recommendStatus',
    method: 'post',
    params: params
  })
}



export function Fileupload(params) {
  debugger
  console.log(params)
  return request({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: '/common/sysFile/upload',
    method: 'post',
    data: params
  })
}

export function createProduct(data) {
  return request({
    url: '/product/create',
    method: 'post',
    data: data
  })
}
// 上架与下架
export function Uppershelf(params) {
  console.log(params, '上架与下架');
  return request({
    url: '/crm/goods/setPublishStatus',
    method: 'post',
    params: params
  })
}
export function updateBrand(data) {
  return request({
    url: '/crm/goods/update',
    method: 'post',
    data: data
  })
}
// 添加产品
export function createBrand(data) {
  return request({
    url: '/crm/goods/save',
    method: 'post',
    data: data
  })
}
// 查看商品详情
export function Commoditydetails(id) {
  return request({
    url: '/crm/goods/getById?id=' + id,
    method: 'get',
    id: id
  })
}
export function updateProduct(id, data) {
  return request({
    url: '/product/update/' + id,
    method: 'post',
    data: data
  })
}

export function getProduct(id) {
  return request({
    url: '/product/updateInfo/' + id,
    method: 'get',
  })
}

